const USAGE:&str =
"Usage: lfsync [options] <dir-from> <dir-to>...
from <dir-from> sync files to all <dir-to>
    options:
        -m=remove   [mode] remove item with in <dir-to> if item not exist in <dir-from>.
        -m=push     [mode] from <dir-from> sync item to <dir-to> if item not exist in <dir-to>.
        -c          mkdir if <dir-to> not exist.
        -e          terminate if error with in sync-time.
        -hash       [slow] use hash to diff file.
        -nr         do'not allow recursive with in directory.
        -q          do'not show any info.
";

pub fn usage() {
    println!("{}", USAGE);
}

pub fn error_and_quit(msg:String) {
    panic!("[ERROR] {}", msg);
}

pub fn error(msg:String) {
    println!("[Error] {}", msg);
}

#[derive(Debug,Copy,Clone)]
pub struct Count {
    n_join:usize,
    n_update:usize,
    n_remove:usize,
    n_push:usize,
}
impl Count {
    pub fn new() -> Self {
        Self {
            n_join:0, n_remove:0, n_update:0, n_push:0,
        }
    }
    pub fn add_join(&mut self, n:usize) ->&mut Self {
        self.n_join += n;
        self
    }
    pub fn add_remove(&mut self, n:usize) ->&mut Self {
        self.n_remove += n;
        self
    }
    pub fn add_update(&mut self, n:usize) ->&mut Self {
        self.n_update += n;
        self
    }
    pub fn add_push(&mut self, n:usize) ->&mut Self {
        self.n_push += n;
        self
    }

}
pub fn result(n:&Count) {
    println!("[Count:Join] {}", n.n_join);
    println!("[Count:Update] {}", n.n_update);
    println!("[Count:Remove] {}", n.n_remove);
    println!("[Count:Push] {}", n.n_push);
}
